/* Block.h
3-10-10
*/

#ifndef BlOCK_H
#define BLOCK_H

#include <vector>
#include <iostream>
#include "levels.h"

class Block
{
    private:
        MyGrafx block_img;

        // hold the current location of the object ( object(s) when using ground towers )
        vector< SDL_Rect > rect_location_vector;

        /* since we need the original x and y location in order to properly draw and
         detect collisions. this list will only have two or six items on it.
         Two items for a block like grassblocksmall, one for X and Y.
         Six items for the towers, three parts to the towers so three pairs of X and Y's
         */
        vector< int > CONST_X_Y_vector;

        string block_type;
        char ascend_or_descend;

    private:
        void Assign_width_height( string block_type, char assend_or_desend, int block_x, int block_y );
        char Left_right_top_bottom_collision( SDL_Rect player_sprite, SDL_Rect block );

        void Detect_bullet_block_collision( Bullets_control &bullets );
        void Detect_block_collision( Player &current_player, Levels *current_level );
        void Detect_block_collision( Enemy_control &enemys );
        void Detect_bullet_damage( Player &current_player, Enemy_control &enemys, Bullets_control &bullets);

    public:
        // pass 'N' for ascend_or_descend if you not creating towers
        Block( int block_x, int block_y, string block_img_name, char ascend_or_descend );
        ~Block();

        /* This function will perform all nessary collision detections for the block class
        */
        void Detect_collision( Player &current_player, Enemy_control &enemys, Levels *current_level, Bullets_control &bullets );

        void Draw( int bgX3, int bgY);

        string Get_block_type();

};
#endif
